package com.wangyuhang;


import com.wangyuhang.Service.testService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import javax.sql.DataSource;
import java.sql.SQLException;

public class test2 {

    public static void main(String[] args) throws SQLException {
        ApplicationContext applicationContext=new ClassPathXmlApplicationContext("applicationContext.xml");
//        testDaoImpl impl= (testDaoImpl) applicationContext.getBean("testDaoImpl");
//        impl.print();

        testService service= (testService) applicationContext.getBean("testServiceImpl");
        service.print();
        DataSource dataSource= (DataSource) applicationContext.getBean("druid");
        if (dataSource.getConnection()!=null){
            System.out.println("ok");
        }

        System.out.println(dataSource);
    }
}
